package com.assist.service.impl;

import java.util.List;

import org.hibernate.Session;

import com.assist.dao.ICategoryDAO;
import com.assist.dao.impl.CategoryDAOImpl;
import com.assist.model.Category;
import com.assist.service.ICategoryService;
import com.assist.util.HibernateUtil;

public class CategoryServiceImpl implements ICategoryService{

	ICategoryDAO categoryDAO = new CategoryDAOImpl();
	
	@Override
	public List<Category> getCategories() {
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		
        List<Category> categories = categoryDAO.getCategories();
		session.getTransaction().commit();
		
		return categories;
	}

}
